﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for SanPhamController
/// </summary>
public class SanPhamController
{
	public SanPhamController()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    SanPhamDAL DAL = new SanPhamDAL();
    public DataTable fnC_Get4Product()
    {
        return DAL.fncG_Get4DataProduct();
    }
    public DataTable funC_GetAllproduct()
    {
        return DAL.funG_GetAllDataProduct();
    }
    public DataTable funC_GetDetailProduct(SanPhamEntity SanPham)
    {
        return DAL.fnG_GetDetailProduct(SanPham);
    }
    public DataTable fnC_GetProductByNhaPP(string NhaPhanPhoi)
    {
        return DAL.fncG_GetProductByNhaPP((NhaPhanPhoiEnum)Enum.Parse(typeof(NhaPhanPhoiEnum), NhaPhanPhoi, true));
    }
    public int fnC_AddNew(SanPhamEntity SanPham)
    {
        return DAL.AddNew(SanPham);
    }
    public int fnC_UpdateProduct(SanPhamEntity SanPham)
    {
        return DAL.UpdateProduct(SanPham); 
    }
    //get max masp
    public DataTable fnC_Getmaxproduct()
    {
        return DAL.funG_GetmaxProduct();
    }
    public string Taomamoi(string s, int n)
    {
        return XL_PhatSinhMaMoi.TaoMaMoi(s, n);
    }
    public int DeleteSp(SanPhamEntity SanPham)
    {
        return DAL.DeleteProduct(SanPham);
    }
    public DataTable fnC_TimKiemSanPham(string timkiem)
    {
        return DAL.fnG_TimKiemSanpham(timkiem);
    }
}